package com.wing.common.enums;

import java.util.Objects;

/**
 * @version 1.1.0
 * @Author hz
 * @Date 2024-08-21 14:15
 **/
public interface ProductEnum {
    enum dictEmum{
        F("0","否"),
        S("1","是");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        dictEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            dictEmum[] homeServiceStatuses = values();
            for (dictEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            dictEmum[] homeServiceStatuses = values();
            for (dictEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum ReviewEmum{
        //状态:pending(0,待评审);accepted(1,已评审);linking(2,待关联)linked（3,已关联）
        DPS("0","待评审"),
        YPS("1","已评审"),
        DGL("2","待关联"),
        YGL("3","已关联");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        ReviewEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            ReviewEmum[] homeServiceStatuses = values();
            for (ReviewEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            ReviewEmum[] homeServiceStatuses = values();
            for (ReviewEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum DemandPlanTypeEmum{
        ZG("1","直供"),
        FZG("2","非直供");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        DemandPlanTypeEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            DemandPlanTypeEmum[] homeServiceStatuses = values();
            for (DemandPlanTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            DemandPlanTypeEmum[] homeServiceStatuses = values();
            for (DemandPlanTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum ReviewUseOrNewEmum{
        CJXCP("1","创建新产品"),
        GLYYCP("2","关联已有产品");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        ReviewUseOrNewEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            ReviewUseOrNewEmum[] homeServiceStatuses = values();
            for (ReviewUseOrNewEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            ReviewUseOrNewEmum[] homeServiceStatuses = values();
            for (ReviewUseOrNewEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum ReviewResultEmum{
        PSTG("1","评审通过"),
        PSBTG("0","评审不通过");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        ReviewResultEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            ReviewResultEmum[] homeServiceStatuses = values();
            for (ReviewResultEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            ReviewResultEmum[] homeServiceStatuses = values();
            for (ReviewResultEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum qualityResultNameEmum{
        HG("0","合格"),
        BHG("1","不合格"),
        QT("2","其他");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        qualityResultNameEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            qualityResultNameEmum[] homeServiceStatuses = values();
            for (qualityResultNameEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            qualityResultNameEmum[] homeServiceStatuses = values();
            for (qualityResultNameEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    enum qualityTestingTypeEmum{
        SJJ(1L,"首件检"),
        CJ(2L,"抽检"),
        ZJ(3L,"终检");
        private Long code;

        private String name;

        public Long getCode() {
            return code;
        }

        public void setCode(Long code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        qualityTestingTypeEmum(Long code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            qualityTestingTypeEmum[] homeServiceStatuses = values();
            for (qualityTestingTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static Long getCodeByName(String name) {
            qualityTestingTypeEmum[] homeServiceStatuses = values();
            for (qualityTestingTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    enum qualityStatusEmum{
        DJC("1","待检测"),
        YJC("2","已检测");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        qualityStatusEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            qualityStatusEmum[] homeServiceStatuses = values();
            for (qualityStatusEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            qualityStatusEmum[] homeServiceStatuses = values();
            for (qualityStatusEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum templateStatusEmum{
        HF("1","恢复"),
        FC("2","废除");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        templateStatusEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            templateStatusEmum[] homeServiceStatuses = values();
            for (templateStatusEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            templateStatusEmum[] homeServiceStatuses = values();
            for (templateStatusEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 质检性质
     */
    enum qualityNatureEmum{
        TYCGWZ(1L,"通用采购物资"),
        CPZJ(2L,"成品"),
        ZCL(3L,"资产类"),
        ZNG(4L,"智能柜"),
        ZDJ(5L,"智刀具"),
        QT(6L,"其他"),
        GXCP(7L,"工序产品");
        private Long code;

        private String name;

        public Long getCode() {
            return code;
        }

        public void setCode(Long code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        qualityNatureEmum(Long code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(Long code) {
            qualityNatureEmum[] homeServiceStatuses = values();
            for (qualityNatureEmum homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static Long getCodeByName(String name) {
            qualityNatureEmum[] homeServiceStatuses = values();
            for (qualityNatureEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 成品订单状态
     */
    enum finishendOrderStatusEmum{
        DTJ("1","待提交"),
        DSH("2","待审核"),
        YSL("3","已受理"),
        YFH("4","已发货"),
        WC("5","完成");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        finishendOrderStatusEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            finishendOrderStatusEmum[] homeServiceStatuses = values();
            for (finishendOrderStatusEmum homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            finishendOrderStatusEmum[] homeServiceStatuses = values();
            for (finishendOrderStatusEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    /**
     * 出库类型
     */
    enum outTypeEmum{
        PDC("PDC","盘点出库"),
        DBC("DBC","调拨出库"),
        SCDC("SCDC","生产订单出库"),
        CPC("CPC","成品销售出库"),
        SCC("SCC","生产领料出库"),
        THC("THC","采购退换货出库");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        outTypeEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            outTypeEmum[] homeServiceStatuses = values();
            for (outTypeEmum homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            outTypeEmum[] homeServiceStatuses = values();
            for (outTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 交付状态 //交付情况:0-未交付，1-交付有剩余，2-交付完成
     */
    enum deliverySituationEmum{

        WJF("0","未交付"),
        JFYSY("1","交付有剩余"),
        JFWC("2","交付完成");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        deliverySituationEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            deliverySituationEmum[] homeServiceStatuses = values();
            for (deliverySituationEmum homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            deliverySituationEmum[] homeServiceStatuses = values();
            for (deliverySituationEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 交付状态 //交付情况:0-未交付，1-交付有剩余，2-交付完成
     */
    enum getTypeEmum{

        SYD("1","从上一道工序领取"),
        PL("2","领取配料");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        getTypeEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            getTypeEmum[] homeServiceStatuses = values();
            for (getTypeEmum homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            getTypeEmum[] homeServiceStatuses = values();
            for (getTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 采购来源
     */
    enum purSourceTypeEmum{

        CGDD("1","采购订单"),
        WLJL("2","物流记录");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        purSourceTypeEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            purSourceTypeEmum[] homeServiceStatuses = values();
            for (purSourceTypeEmum homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            purSourceTypeEmum[] homeServiceStatuses = values();
            for (purSourceTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 处置方式
     */
    enum dealWayEmum{

        BF("0","报废"),
        FX("1","返修"),
        CPRK("2","成品入库");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        dealWayEmum(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            dealWayEmum[] homeServiceStatuses = values();
            for (dealWayEmum homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            dealWayEmum[] homeServiceStatuses = values();
            for (dealWayEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

}
